/*
 * RestConfiguration.java
 * Copyright (c) 2014, 2019, Kiri. 
 * All rights reserved.
 */
package com.onesalt.web.common;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.SerializationFeature;

/**
 * 系统配置
 *
 * @author kiri
 * @date 2015年3月6日
 * @version 1.0
 */
@Configuration
public class RestConfiguration {

	@Bean
	public MappingJackson2HttpMessageConverter jacksonConverter() {
		MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
//		converter.getObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, true);
		converter.getObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
		converter.getObjectMapper().setSerializationInclusion(Include.NON_NULL);
		return converter;
	}
}
